package com.mapper;

import com.bean.Student;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface StudentMapperByAnnotation {

    @Select("select * from t_stu where stuno=#{stuid}")
    @Results({
            @Result(id = true,column = "stuno",property = "stuno"),
            @Result(column = "stuname",property = "stuname"),
            @Result(column = "grade",property = "grade"),
            @Result(column = "dept",property = "dept"),
            @Result(column = "classid",property = "clazzBean",one = @One(select = "com.mapper.ClazzMapperByAnnotation2.getClazzById")),

    })
    public Student findStuForClazzByStuId(Integer stuid);

    @Select("select * from t_stu where classid = #{classid}")
    public Student findStuForClazzId(Integer classid);


    @Select("select * from t_stu where stuno in (select stuno from t_sc where cid=#{cid})")
    public Student findStuForCourseId(Integer cid);



}
